import { getBaseUrl } from '@/services/urlconst';
import { requestFunComponFiex } from '@/utils';
import { useRequest } from 'umi';
const baseUrl = getBaseUrl();
// 撤销接口
const handleRemoveService = (callback: (res: any) => void, requestUrl) => {
  const request = useRequest(
    (payload: any) => {
      let bodyParams = {
        ...payload,
      };
      let reqUrl = `${baseUrl}${requestUrl}`;
      return requestFunComponFiex('DELETE', reqUrl, bodyParams);
    },
    {
      manual: true,
      onSuccess: callback,
    },
  );
  return {
    handleRemoveRun: request?.run,
    handleRemoveLoading: request?.loading,
  };
};

export { handleRemoveService };
